import request from '@/config/axios'

// 会员和角色关联 VO
export interface CrewRoleVO {
  id: number // 自增编号
  memberId: number // memberID
  memberName: string //会员昵称
  storeId: number // 店铺编号
  storeName: string //店铺名称
  roleId: number // 角色ID
  roleName: string //角色名称
}

// 会员和角色关联 API
export const CrewRoleApi = {
  // 查询会员和角色关联分页
  getCrewRolePage: async (params: any) => {
    return await request.get({ url: `/store/crew-role/page`, params })
  },

  // 查询会员和角色关联详情
  getCrewRole: async (id: number) => {
    return await request.get({ url: `/store/crew-role/get?id=` + id })
  },

  // 新增会员和角色关联
  createCrewRole: async (data: CrewRoleVO) => {
    return await request.post({ url: `/store/crew-role/create`, data })
  },

  // 修改会员和角色关联
  updateCrewRole: async (data: CrewRoleVO) => {
    return await request.put({ url: `/store/crew-role/update`, data })
  },

  // 删除会员和角色关联
  deleteCrewRole: async (id: number) => {
    return await request.delete({ url: `/store/crew-role/delete?id=` + id })
  },

  // 导出会员和角色关联 Excel
  exportCrewRole: async (params) => {
    return await request.download({ url: `/store/crew-role/export-excel`, params })
  },
}
